package com.suzus.three;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.MessageProperties;
import com.suzus.utils.RabbitMqUtils;

import java.util.Scanner;

public class Task2 {
    public static final String TASK_QUEUE_NAME = "ack_queue";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();

        boolean durable=true;

        channel.queueDeclare(TASK_QUEUE_NAME,durable,false,false,null);

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String message = scanner.next();
            channel.basicPublish("",TASK_QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN,message.getBytes("UTF-8"));
            System.out.println("Product output");
        }
    }
}
